// Copyright (c) 2025, 大连理工大学 (Dalian University of Technology)
//
// Licensed under the Mulan PSL v2.
// You can use this file according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of the License at
//
//     http://license.coscl.org.cn/MulanPSL2
//
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. SEE THE MULAN PSL v2
// FOR MORE DETAILS.

#include <gtest/gtest.h>

#include "DBManager/IService/Input/Design/IBEADVARService.h"
#include "DBManager/UnitTest/HDF5/TestDB.h"

using namespace SG::DataStructure::FEM;
using namespace SG::DBManager;

class I_DesignTest : public testing::Test
{};
#include "DBManager/IService/Input/Design/IBEADVARService.h"
TEST_F (I_DesignTest, BEADVARTest)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IBEADVARService> ();

    SG::DataStructure::FEM::BEADVARData data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::BEADVARData _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDCONADDService.h"
TEST_F (I_DesignTest, DCONADDTest)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDCONADDService> ();

    SG::DataStructure::FEM::DCONADDData data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::DCONADDData _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDCONSTRService.h"
TEST_F (I_DesignTest, DCONSTRTest)
{
    DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDCONSTRService> ();

    SG::DataStructure::FEM::DCONSTRData data;
    data.m_id = 1;
    service->Add (data);

    SG::DataStructure::FEM::DCONSTRData _OUT outData;
    service->FindById (1, outData);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDDVALService.h"
TEST_F (I_DesignTest, DDVALTest)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDDVALService> ();

    SG::DataStructure::FEM::DDVALData data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::DDVALData _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDESVARService.h"
TEST_F (I_DesignTest, DESVARTest)
{
    DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDESVARService> ();

    SG::DataStructure::FEM::DESVARData data;
    data.m_id = 1;
    service->Add (data);

    SG::DataStructure::FEM::DESVARData _OUT outData;
    service->FindById (1, outData);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDLINKService.h"
TEST_F (I_DesignTest, DLINKTest)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDLINKService> ();

    SG::DataStructure::FEM::DLINKData data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::DLINKData _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDOPTPRMService.h"
TEST_F (I_DesignTest, DOPTPRMTest)
{
    DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDOPTPRMService> ();

    SG::DataStructure::FEM::DOPTPRMData data;
    data.m_APRCOD   = 1;    ///<
    data.m_domainId = 111;  ///<
    service->Set (data);

    SG::DataStructure::FEM::DOPTPRMData _OUT outData;
    outData = service->Get ();
    ASSERT_EQ (outData.m_APRCOD, 1);
    ASSERT_EQ (outData.m_domainId, 111);
}

#include "DBManager/IService/Input/Design/IDRESP1Service.h"
TEST_F (I_DesignTest, DRESP1Test)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDRESP1Service> ();

    SG::DataStructure::FEM::DRESP1Data data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::DRESP1Data _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDRESP2Service.h"
TEST_F (I_DesignTest, DRESP2Test)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDRESP2Service> ();

    SG::DataStructure::FEM::DRESP2Data data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::DRESP2Data _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDRESP3Service.h"
TEST_F (I_DesignTest, DRESP3Test)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDRESP3Service> ();

    SG::DataStructure::FEM::DRESP3Data data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::DRESP3Data _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDSCREENService.h"
TEST_F (I_DesignTest, DSCREENTest)
{
    DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDSCREENService> ();

    SG::DataStructure::FEM::DSCREENData data;
    data.m_TYPE     = 1;     ///<
    data.m_TRS      = 22.2;  ///<
    data.m_NSTR     = 3;     ///<
    data.m_domainId = 4;     ///<

    service->Set (data);

    SG::DataStructure::FEM::DSCREENData _OUT outData;
    outData = service->Get ();
    ASSERT_EQ (outData.m_TYPE, 1);
    ASSERT_EQ (outData.m_TRS, 22.2);
    ASSERT_EQ (outData.m_NSTR, 3);
    ASSERT_EQ (outData.m_domainId, 4);
}

#include "DBManager/IService/Input/Design/IDTABLEService.h"
TEST_F (I_DesignTest, DTABLETest)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDTABLEService> ();

    SG::DataStructure::FEM::DTABLEData data;
    data.m_domainId = 123;

    for (int i = 0; i < 3; i++)
    {
        SG::DataStructure::FEM::DTABLEData::VALUESData v1;
        v1.m_VALUE = i;
        strcpy (v1.m_LABEL, "aaaaaaa");
        v1.m_VALUEI = i * 10;
        data.m_VALUESList.push_back (v1);
    }
    service->Set (data);

    SG::DataStructure::FEM::DTABLEData _OUT outData;
    outData = service->Get ();

    ASSERT_EQ (outData.m_domainId, 123);
    ASSERT_EQ (outData.m_VALUESList.size (), 3);

    ASSERT_EQ (outData.m_VALUESList[0].m_VALUE, 0);
    ASSERT_STREQ (outData.m_VALUESList[0].m_LABEL, "aaaaaaa");
    ASSERT_EQ (outData.m_VALUESList[0].m_VALUEI, 0);

    ASSERT_EQ (outData.m_VALUESList[1].m_VALUE, 1);
    ASSERT_STREQ (outData.m_VALUESList[1].m_LABEL, "aaaaaaa");
    ASSERT_EQ (outData.m_VALUESList[1].m_VALUEI, 10);

    ASSERT_EQ (outData.m_VALUESList[2].m_VALUE, 2);
    ASSERT_STREQ (outData.m_VALUESList[2].m_LABEL, "aaaaaaa");
    ASSERT_EQ (outData.m_VALUESList[2].m_VALUEI, 20);
}

#include "DBManager/IService/Input/Design/IDTABLE2Service.h"
TEST_F (I_DesignTest, DTABLE2Test)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDTABLE2Service> ();

    SG::DataStructure::FEM::DTABLE2Data data;
    data.m_domainId = 123;
    for (int i = 0; i < 3; i++)
    {
        SG::DataStructure::FEM::DTABLE2Data::VALUESData vd;
        strcpy (vd.m_FNAME, "aaaaaaa");
        strcpy (vd.m_PNAME, "bbbbbbb");
        strcpy (vd.m_LABEL, "ccccccc");
        vd.m_pId = i;
        data.m_VALUESList.push_back (vd);
    }

    service->Set (data);

    SG::DataStructure::FEM::DTABLE2Data outData;
    outData = service->Get ();

    ASSERT_EQ (outData.m_domainId, 123);
    ASSERT_EQ (outData.m_VALUESList.size (), 3);

    ASSERT_STREQ (outData.m_VALUESList[0].m_FNAME, "aaaaaaa");
    ASSERT_STREQ (outData.m_VALUESList[0].m_PNAME, "bbbbbbb");
    ASSERT_STREQ (outData.m_VALUESList[0].m_LABEL, "ccccccc");
    ASSERT_EQ (outData.m_VALUESList[0].m_pId, 0);

    ASSERT_STREQ (outData.m_VALUESList[1].m_FNAME, "aaaaaaa");
    ASSERT_STREQ (outData.m_VALUESList[1].m_PNAME, "bbbbbbb");
    ASSERT_STREQ (outData.m_VALUESList[1].m_LABEL, "ccccccc");
    ASSERT_EQ (outData.m_VALUESList[1].m_pId, 1);

    ASSERT_STREQ (outData.m_VALUESList[2].m_FNAME, "aaaaaaa");
    ASSERT_STREQ (outData.m_VALUESList[2].m_PNAME, "bbbbbbb");
    ASSERT_STREQ (outData.m_VALUESList[2].m_LABEL, "ccccccc");
    ASSERT_EQ (outData.m_VALUESList[2].m_pId, 2);
}

#include "DBManager/IService/Input/Design/IDVCREL1Service.h"
TEST_F (I_DesignTest, DVCREL1Test)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDVCREL1Service> ();

    SG::DataStructure::FEM::DVCREL1Data data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::DVCREL1Data _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDVCREL2Service.h"
TEST_F (I_DesignTest, DVCREL2Test)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDVCREL2Service> ();

    SG::DataStructure::FEM::DVCREL2Data data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::DVCREL2Data _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDVGRIDService.h"
TEST_F (I_DesignTest, DVGRIDTest)
{
    DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDVGRIDService> ();

    SG::DataStructure::FEM::DVGRIDData data;
    data.m_id = 1;
    service->Add (data);

    SG::DataStructure::FEM::DVGRIDData _OUT outData;
    service->FindById (1, outData);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDVLREL1Service.h"
TEST_F (I_DesignTest, DVLREL1Test)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDVLREL1Service> ();

    SG::DataStructure::FEM::DVLREL1Data data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::DVLREL1Data _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDVLREL2Service.h"
TEST_F (I_DesignTest, DVLREL2Test)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDVLREL2Service> ();

    SG::DataStructure::FEM::DVLREL2Data data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::DVLREL2Data _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDVMREL1Service.h"
TEST_F (I_DesignTest, DVMREL1Test)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDVMREL1Service> ();

    SG::DataStructure::FEM::DVMREL1Data data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::DVMREL1Data _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDVMREL2Service.h"
TEST_F (I_DesignTest, DVMREL2Test)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDVMREL2Service> ();

    SG::DataStructure::FEM::DVMREL2Data data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::DVMREL2Data _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDVPREL1Service.h"
TEST_F (I_DesignTest, DVPREL1Test)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDVPREL1Service> ();

    SG::DataStructure::FEM::DVPREL1Data data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::DVPREL1Data _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDVPREL2Service.h"
TEST_F (I_DesignTest, DVPREL2Test)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDVPREL2Service> ();

    SG::DataStructure::FEM::DVPREL2Data data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::DVPREL2Data _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDVPSURFService.h"
TEST_F (I_DesignTest, DVPSURFTest)
{
    DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDVPSURFService> ();

    SG::DataStructure::FEM::DVPSURFData data;
    data.m_id = 1;
    service->Add (data);

    SG::DataStructure::FEM::DVPSURFData _OUT outData;
    service->FindById (1, outData);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/IDVSHAPService.h"
TEST_F (I_DesignTest, DVSHAPTest)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<IDVSHAPService> ();

    SG::DataStructure::FEM::DVSHAPData data;
    data.m_domainId = 123;
    for (int i = 0; i < 3; i++)
    {
        SG::DataStructure::FEM::DVSHAPData::SFACTSData vd;
        vd.m_COLID = 11;
        vd.m_DVID  = 12;
        vd.m_SF    = 12.3;
        data.m_SFACTSList.push_back (vd);
    }

    service->Set (data);

    SG::DataStructure::FEM::DVSHAPData outData;
    outData = service->Get ();

    ASSERT_EQ (outData.m_domainId, 123);
    ASSERT_EQ (outData.m_SFACTSList.size (), 3);

    ASSERT_EQ (outData.m_SFACTSList[0].m_COLID, 11);
    ASSERT_EQ (outData.m_SFACTSList[0].m_DVID, 12);
    ASSERT_EQ (outData.m_SFACTSList[0].m_SF, 12.3);

    ASSERT_EQ (outData.m_SFACTSList[1].m_COLID, 11);
    ASSERT_EQ (outData.m_SFACTSList[1].m_DVID, 12);
    ASSERT_EQ (outData.m_SFACTSList[1].m_SF, 12.3);

    ASSERT_EQ (outData.m_SFACTSList[2].m_COLID, 11);
    ASSERT_EQ (outData.m_SFACTSList[2].m_DVID, 12);
    ASSERT_EQ (outData.m_SFACTSList[2].m_SF, 12.3);
}

#include "DBManager/IService/Input/Design/IMODTRAKService.h"
TEST_F (I_DesignTest, MODTRAKDatatest)
{
    DB::ServiceFactory->ClearDatabase ();
    // 获取服务
    auto service = DB::ServiceFactory->get<IMODTRAKService> ();

    SG::DataStructure::Common::Id const id = 55;

    // 创建对象
    MODTRAKData obj;
    obj.m_id = 1;
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    // 创建对象
    obj.m_id = id;

    // 添加对象
    ASSERT_EQ (service->Add (obj), SG::DataStructure::Common::Status::STATUS_Success);

    std::vector<MODTRAKData> _OUT outData;
    ASSERT_EQ (service->FindBySId (id, outData), SG::DataStructure::Common::Status::STATUS_Success);

    ASSERT_EQ (outData.size (), 1);
    ASSERT_EQ (service->Size (), 2);
}

#include "DBManager/IService/Input/Design/ISEDLINKService.h"
TEST_F (I_DesignTest, SEDLINKTest)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<ISEDLINKService> ();

    SG::DataStructure::FEM::SEDLINKData data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::SEDLINKData _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/ISEDRSP2Service.h"
TEST_F (I_DesignTest, SEDRSP2Test)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<ISEDRSP2Service> ();

    SG::DataStructure::FEM::SEDRSP2Data data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::SEDRSP2Data _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/ISEDRSP3Service.h"
TEST_F (I_DesignTest, SEDRSP3Test)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<ISEDRSP3Service> ();

    SG::DataStructure::FEM::SEDRSP3Data data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::SEDRSP3Data _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/ITOMVARService.h"
TEST_F (I_DesignTest, TOMVARTest)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<ITOMVARService> ();

    SG::DataStructure::FEM::TOMVARData data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::TOMVARData _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}

#include "DBManager/IService/Input/Design/ITOPVARService.h"
TEST_F (I_DesignTest, TOPVARTest)
{
    // DB::ServiceFactory->ClearDatabase ();

    auto service = DB::ServiceFactory->get<ITOPVARService> ();

    SG::DataStructure::FEM::TOPVARData data;
    data.m_id = 1;
    ASSERT_EQ (service->Add (data), SG::DataStructure::Common::Status::STATUS_Success);

    SG::DataStructure::FEM::TOPVARData _OUT outData;
    ASSERT_EQ (service->FindById (1, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->FindByIndex (0, outData), SG::DataStructure::Common::Status::STATUS_Success);
    ASSERT_EQ (outData.m_id, 1);

    ASSERT_EQ (service->Size (), 1);
    ASSERT_EQ (service->Count (1), 1);
}
